package com.base.common.model.http.upLoad;

import com.base.common.model.bean.UploadImageBean;
import com.base.common.model.http.HttpUtils;

import java.util.HashMap;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

public interface UploadService {


    static UploadService getUpLoadFilesService(String baseUrl) {
        return HttpUtils.getInstance(baseUrl).getUpLoadFilesService(UploadService.class);
    }


    /**
     * 多文件上传
     *
     * @param params
     * @return
     */
    @POST("p/oss/upload")
    Observable<Object> ossUpload(@Body HashMap<String, Object> params);


    /**
     * 单文件上传
     *
     * @param part
     * @return
     */
    @POST("p/oss/upload")
    @Multipart
    Observable<UploadImageBean> ossUpload(@Part MultipartBody.Part part);


    /**
     * 文件下载
     */
    @Streaming
    @GET
    Observable<ResponseBody> downLoadFileApk(@Url String url);

}
